//https://leetcode.cn/problems/missing-number/
class Solution {
    public int missingNumber(int[] nums) {
        //高斯求和
        int sum1 = 0;
        for(int i = 0; i < nums.length; i++) sum1 += nums[i];
        int sum2 = 0;
        for(int i = 0;i < nums.length + 1; i++) sum2 += i;
        return sum2 - sum1;
    }
}